<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="crm.model.Customer"%>
<%@page import="crm.model.Linkman"%>
<%@page import="crm.model.Salearea"%>
<%@page import="crm.util.ParamUtil"%>
<%@page import="java.util.*"%>
<%@page import="crm.control.CustomerControl"%>
<%@page import="crm.control.LinkmanControl"%>
<%@page import="crm.control.SaleareaControl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../resources/css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../resources/css/inner.css" type="text/css" media="screen" />
<style type='text/css'>
 a{font-size:12px; text-decoration:none; color:#70B300;}
</style>
		<title>customer_update</title>
	</head>
	<script type="text/javascript"
		src="../../../resources/js/WebCalendar.js">
</script>
	<body>
		<%
			request.setCharacterEncoding("UTF-8");
			int id = Integer.parseInt(request.getParameter("id"));
			//System.out.print(id);
			Customer customer = new Customer();
			
			customer=CustomerControl.getCustomerById(id);
			ArrayList linkmans=LinkmanControl.getAllLinkmans();
			ArrayList saleareas=SaleareaControl.getAllSaleareas();
			
			String area="";
						for(int i=0;i<saleareas.size();i++)
						{
						  Salearea sa=(Salearea)saleareas.get(i);
						 
						   if(sa.getId()==customer.getArea_id())
						     area+="<option value='"+sa.getId()+"' label='"+sa.getArea_name()+"' selected>"+sa.getArea_name()+"</option>";
						   else
						      area+="<option value='"+sa.getId()+"' label='"+sa.getArea_name()+"'>"+sa.getArea_name()+"</option>";
						}
		%>
		<form action="customer_update_do.jsp?id=<%=id%>" method="post">
			<table>
				<tr>
					<td>
						客户名称
					</td>
					<td>
						<input type="text" name="name"
							value="<%=customer.getName()%>" />
					</td>
				</tr>
				<tr>
					<td>
						客户创建时间
					</td>
					<td>
						<input type="text" name="crete_time" maxlength="20"
							onClick="SelectDate(this,'yyyy-MM-dd')"
							value="<%=customer.getCrete_time()%>" />
					</td>
				</tr>
				<tr>
					<td>
						客户地址
					</td>
					<td>
						<input type="text" name="address"
							value="<%=customer.getAddress()%>" />
					</td>
				</tr>
				<tr>
					<td>
						手机号码
					</td>
					<td>
						<input type="text" name="phone"
							value="<%=customer.getPhone()%>" />
					</td>
				</tr>
				
				<tr>
					<td>
						所属区域
					</td>
					<td>
						 <select name="area_id" id="area_id" >
                         <%=area%>
                          </select>
					</td>
				</tr>
				<tr>
					<td>
						客户类型
					</td>
					<td>
						<input type="text" name="type"
							value="<%=customer.getType()%>" />
					</td>
				</tr>
				<tr>
					<td>
						客户来源
					</td>
					<td>
						<input type="text" name="origin"
							value="<%=customer.getOrigin()%>" />
					</td>
				</tr>
				<tr>
					<td>
						客户从事行业
					</td>
					<td>
						<input type="text" name="business"
							value="<%=customer.getBusiness()%>" />
					</td>
				</tr>
				<tr>
					<td colspan='2' style='text-align: center;'>
						<input type="submit" class='button' id="submit" value="提交" />
					</td>
					
				</tr>
			</table>
		</form>
	</body>
</html>